<?php
/**
 * Created by PhpStorm.
 * User: Admin
 * Date: 2021/6/23
 * Time: 11:03
 */

namespace app\admin\library;


class Capability
{
    /**
     * 获取capability内容
     * @param $project
     * @param $module
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function capability($project, $module)
    {
        //获取模块能力
        $capability_model = new \app\admin\model\MwModuleCapability();
        $module_list = $capability_model->getModuleList($project, $module);

        $capability = [];
        if ($module_list){
            foreach ($module_list as $value){
                $capability[$value['name']] = $value['is_switch'] ? true : false;
            }
        }
        return $capability;
    }
}